require.config({
    baseUrl: '/javascripts',
    paths: {
        angular: 'vendor/angular/angular',
        uiRouter: 'vendor/angular/angular-ui-router.min',
        // uiRouterExtras: 'vendor/angular/ct-ui-router-extras.min',
        jquery: 'vendor/jquery/jquery',
        jquerySortable: 'vendor/jquery/jquery.sortable',
        leaflet: 'vendor/leaflet/leaflet',
        leafletdraw: 'vendor/leaflet/leaflet.draw',
        semantic: 'vendor/semantic/semantic',
        highcharts: 'vendor/highcharts/highcharts',
        crossingSpecificValue: 'vendor/highcharts/crossingSpecificValue',
        exporting: 'vendor/highcharts/exporting',
        jsonConverters: 'vendor/jsonconverter/jsonConverters',
        jsonpack: 'vendor/jsonpack/jsonpack',
        calendar: 'vendor/jquery/jquery.calendar',
        slides: 'vendor/jquery/jquery.slides',
        leafletawe: 'vendor/leaflet/leaflet.awesome-markers',
        base64: 'vendor/base64.min',
        canvg: 'vendor/canvg/canvg',
        rgbcolor: 'vendor/canvg/rgbcolor',
        StackBlur: 'vendor/canvg/StackBlur',
        jspdf: 'vendor/jsPDF/jspdf',
        jspdfAddImage: 'vendor/jsPDF/jspdf.plugin.addimage',
        FileSaver: 'vendor/jsPDF/FileSaver.min',
        ngAnimate: 'vendor/angular/angular-animate.min',
        plupload: "vendor/plupload/plupload.full.min",
        pluploadCn: 'vendor/plupload/i18n/zh_CN',
        qiniu: 'vendor/qiniu/qiniu',
        lightbox: 'vendor/jquery/lightbox',
        app: 'app'
    },
    shim: {
        'angular': {
            'exports': 'angular'
        },
        'leaflet': {
            'exports': 'leaflet'
        },
        'leafletawe': ['leaflet'],
        'jquery': {
            'exports': 'jquery'
        },
        'lightbox': ['jquery'],
        'jquerySortable': ['jquery'],
        'jsonpack': {
            'exports': 'jsonpack'
        },
        'jsonConverters': {
            'exports': 'jsonConverters'
        },
        'calendar': ['jquery'],
        'slides': ['jquery'],
        'semantic': ['jquery'],
        'highcharts': ['jquery'],
        'crossingSpecificValue': ['jquery', 'highcharts'],
        'exporting': ['jquery', 'highcharts'],
        'leafletdraw': ['leaflet'],
        'jspdfAddImage': ['jspdf'],
        'uiRouter': ['angular'],
        // 'uiRouterExtras': ['angular'],
        "ngAnimate": ['angular'],
        'pluploadCn': ['plupload'],
        'qiniu': ['plupload'],
        'app': ['angular', 'uiRouter']
    }
});

require(['angular', 'uiRouter', 'leaflet', 'ngAnimate', 'leafletawe', 'app', 'jquery', 'semantic', 'slides', 'base64', 'plupload', 'pluploadCn', 'qiniu'], function () {
    'use strict';
    L.Icon.Default.imagePath = 'stylesheets/leaflet/images';
    window.console = window.console || {};
    window.console.log = window.console.log || function () { };
    //手动启动app
    angular.element().ready(function () {
        var htmlElement = document.getElementsByTagName("html")[0];
        var $html = angular.element(htmlElement);
        $html.attr("data-ng-app", "App");
        $html.attr("id", "App");

        angular.bootstrap($html, ["App"]);
    });
});
